1. Technical Field
The present invention relates generally to an improved data processing system and, in particular, to an improved method and apparatus for rendering drawings in a data processing system. Still more particularly, the present invention relates to a method and apparatus for identifying visible and occluded objects in a data processing system.
2. Description of Related Art
In general, a goal of 3D computer graphics is to create a 2D projection on a display screen of a three-dimensional model as viewed from a predetermined viewpoint in three-dimensional model space. One aspect of such a projection is the need to keep track of which objects are in front of other objects, and which are behind, when viewed from the viewpoint. This knowledge is necessary to ensure that, for example, a building in the foreground will properly occlude a building in the distance. This aspect of the rendering process is known as xe2x80x9cocclusion cullingxe2x80x9d.
One popular technique to perform occlusion culling uses a construct known as a xe2x80x9cz-bufferxe2x80x9d. A standard z-buffer linearly associates a number called the xe2x80x9cz valuexe2x80x9d, representing the distance from the observer (depth in the scene relative to a projection plane) with each pixel drawn on the screen. When the first object of a scene is projected, attributes of its pixels (such as color) are stored in a xe2x80x9cframe bufferxe2x80x9d, and the z value associated with each pixel is separately stored in the z-buffer. If a second object from the model subsequently projects onto a pixel containing data from the first object, the second object""s z value is compared against the z value already stored for that pixel. Only if the second object""s z value is less (representing an object closer to the view) will the new pixel and z-buffer be updated with the second object""s attributes.
Consider rendering two objects, object 1 and object 2, located at different positive depths from a projection plane or image plane located at z equal to zero in the model space. Object 1 is projected and rendered first. Object 2 is rendered second. The z-buffer prevents pixels of object 2 from being written to the frame buffer in the locations where object 1 has already written pixels with a lesser z value. Thus, object 2 appears in the ultimately displayed image to be behind object 1, as desired.
Z-buffers can be implemented in either hardware or software. The numbers stored can be either floating point or integer values. Any number of bits can be devoted to the z values. In general, the more bits that are devoted to storing the z value, the finer the resolution in distance that can be achieved. Because z values represent the depth of an object in a scene, z values can be more generally referred to as xe2x80x9cdepth valuesxe2x80x9d, and z-buffers can be more generally referred to as xe2x80x9cdepth buffersxe2x80x9d. Also, depth values can be increasing with increasing depth, or can be decreasing with increasing depth. Many of the processes used to identify occluded and non-occluded objects take time and add to the time needed to render a scene.
Therefore, it would be advantageous to have an improved method and apparatus for identifying occluded objects.
The present invention provides a method for displaying a drawing for a viewpoint in a data processing system wherein the drawing includes a set of objects. A plurality of bounding boxes and complexity data for the set of objects is received, wherein a bounding box and complexity data are associated with each object within the set of objects. Occluders within the set of objects are selected using the plurality of bounding boxes and complexity data. These occluders are used to identify visible objects from the set of objects for the viewpoint.